<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .hidden {
            display: none!important;
        }
        .award_users {
            z-index: 999;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color:  white;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .center {
            width: 100px;
            margin: 20px auto;
            background-color: red;
            color: white;
        }
    </style>
</head>
<body>
    <div class="box">
        <div id="loading" class="hidden">抽奖中...</div>
        <button id="btn">抽奖</button>
    </div>
    <div class="award_users hidden">
        <table>
            <thead>
                <th>序号</th>
                <th>姓名</th>
                <th>手机号</th>
            </thead>
            <tbody>

            </tbody>
        </table>
        <div class="center close">关闭，再抽</div>
    </div>
    <script>
        let isPicking = false;
        const btn = document.querySelector('#btn');
        const loading = document.querySelector('#loading');
        const award_users = document.querySelector('.award_users');
        const close = document.querySelector('.close');

        function doAward() {
            if (isPicking) return;
            isPicking = true;
            // this,setAttribute('disabled', 'disabled');
            this.classList.add('hidden');//此处的this指向btn
            loading.classList.remove('hidden');

            setTimeout(() => {
                isPicking = false
                this.classList.remove('hidden');
                loading.classList.add('hidden');
                award_users.classList.remove('hidden');
            }, 1000);
        }
        btn.addEventListener('click', doAward);
        close.addEventListener('click', () => {
            award_users.classList.add('hidden');
        });
    </script>
</body>
</html>